home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / EMULATOR / V2600 / !v2600 / h / macro < prev    next >
Text File  |  1998-03-23  |  2KB  |  101 lines

  1. /*****************************************************************************
  2.  
  3.    This file is part of x2600, the Atari 2600 Emulator
  4.    ===================================================
  5.    
  6.    Copyright 1996 Alex Hornby. For contributions see the file CREDITS.
  7.  
  8.    This software is distributed under the terms of the GNU General Public
  9.    License. This is free software with ABSOLUTELY NO WARRANTY.
  10.    
  11.    See the file COPYING for details.
  12.    
  13.    $Id: macro.h,v 1.7 1996/11/24 16:55:40 ahornby Exp $
  14. ******************************************************************************/
  15.  
  16. /*
  17.  *
  18.  * Originally from x64 by
  19.  *   Vesa-Matti Puro (vmp@lut.fi)
  20.  *   Jarkko Sonninen (sonninen@lut.fi)
  21.  * 
  22.  * NOTE: Can add zero page optimizations
  23.  */
  24.  
  25. #ifndef X2600_MACRO_H
  26. #define X2600_MACRO_H
  27.  
  28.  
  29. #include "types.h"
  30. #include "cpu.h"
  31.  
  32. #define LOAD(a)              decRead(a)
  33. #define LOADEXEC(a)          undecRead(a)
  34. #define DLOAD(a)                dbgRead(a)
  35. #define LOAD_ZERO(a)         decRead((ADDRESS)a)
  36. #define LOAD_ADDR(a)        ((LOAD(a+1)<<8)+LOAD(a))
  37. #define LOAD_ZERO_ADDR(a)       LOAD_ADDR(a)
  38.  
  39. #define STORE(a,b)              decWrite((a),(b))
  40. #define STORE_ZERO(a,b)         decWrite((a),(b))
  41.  
  42. #define PUSH(b)         decWrite(SP+0x100,(b));SP--
  43. #define PULL()            decRead((++SP)+0x100)
  44.  
  45. #define UPPER(ad)        (((ad)>>8)&0xff)
  46. #define LOWER(ad)        ((ad)&0xff)
  47. #define LOHI(lo,hi)             ((lo)|((hi)<<8))
  48.  
  49. #define REL_ADDR(pc,src)     (pc+((SIGNED_CHAR)src))
  50.  
  51. #define SET_SIGN(a)        (SF=(a)&S_SIGN)
  52. #define SET_ZERO(a)        (ZF=!(a))
  53. #define SET_CARRY(a)          (CF=(a))
  54.  
  55. #define SET_INTERRUPT(a)    (IF=(a))
  56. #define SET_DECIMAL(a)        (DF=(a))
  57. #define SET_OVERFLOW(a)        (OF=(a))
  58. #define SET_BREAK(a)        (BF=(a))
  59.  
  60. #define SET_SR(a)        (SF=(a) & S_SIGN,\
  61.                  ZF=(a) & S_ZERO,\
  62.                  CF=(a) & S_CARRY,\
  63.                  IF=(a) & S_INTERRUPT,\
  64.                  DF=(a) & S_DECIMAL,\
  65.                  OF=(a) & S_OVERFLOW,\
  66.                  BF=(a) & S_BREAK)
  67.  
  68. /*#define GET_SR()        ((SF ? S_SIGN : 0) |\
  69.                  (ZF ? S_ZERO : 0) |\
  70.                  (CF ? S_CARRY : 0) |\
  71.                  (IF ? S_INTERRUPT : 0) |\
  72.                  (DF ? S_DECIMAL : 0) |\
  73.                  (OF ? S_OVERFLOW : 0) |\
  74.                  (BF ? S_BREAK : 0) | S_NOTUSED)*/
  75. #define GET_SR()              (SF|ZF|CF|IF|DF|OF|BF|S_NOTUSED)
  76.  
  77. #define IF_SIGN()        SF
  78. #define IF_ZERO()        ZF
  79. #define IF_CARRY()        CF
  80. #define IF_INTERRUPT()        IF
  81. #define IF_DECIMAL()        DF
  82. #define IF_OVERFLOW()        OF
  83. #define IF_BREAK()        BF
  84.  
  85.  
  86. #define sprint_status()     sprint_binary(GET_SR())
  87.  
  88.  
  89. #endif  /* X2600_MACRO_H */
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.